<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
		<meta http-equiv="Content-Language" content="en" />
		<%= stylesheet_link_tag 'games', '/jscalendar-1.0/calendar-tas' %>
		<%= javascript_include_tag :defaults, '/jscalendar-1.0/calendar_stripped', '/jscalendar-1.0/calendar-setup_stripped', '/jscalendar-1.0/lang/calendar-en' %>
		<script type="text/javascript">
			<!--
<% @weblog.archives(@time_zone, false).each_key do |k| -%>
				allowedDates.push("<%= k.strftime '%m/%d/%Y' %>");
<% end -%>
			-->
		</script>
		<title><%= @weblog.name %></title>
	</head>
	<body>
		<div>
			<h1>
				<%= link_to_unless_current @weblog.name, weblog_path(@weblog) %>
			</h1>
			<h2><%= @weblog.description %></h2>
			<div>
<%= yield -%>
			</div>
			<div id="divCalendar">
			</div>
			<ul>
				<li>
					<h3>about <%= @weblog.users.size > 1 ? 'me'.pluralize : 'me' %></h3>
					<ul>
<% @weblog.users.each do |u| -%>
						<li>
							<%= image_tag user_path(u) + ".gif", :alt => u.username, :size => '48x48' %>
							<%= link_to u.username + ' (' + u.entries_count.to_s + ')' %><br />
							<%= link_to 'View my profile', user_path(u) %><br />
							<%= mail_to u.email, 'Contact me' %>
						</li>
<% end -%>
					</ul>
				</li>
				<li>
					<h3>control panel</h3>
					<ul>
						<li>User: <%= logged_in? ? current_user.username : 'Anonymous' %></li><% if logged_in? %>
						<li>[<%= link_to 'Home', edit_user_path(current_user) %>]&nbsp;&nbsp;[<%= link_to 'Administer', edit_weblog_path(@weblog) %>]</li>
						<li>[<%= link_to 'Logout', :controller => :users, :action => :logout %>]&nbsp;&nbsp;[<%= link_to 'Switch' %>]</li><% else %>
						<li>[<%= link_to 'Login', :controller => :users, :action => :login %>]&nbsp;&nbsp;[<%= link_to 'Register', new_user_path %>]</li><% end %>
					</ul>
				</li>
				<li>
					<h3>albums &amp; categories</h3>
					<ul>
<% @weblog.holders.each do |h| -%>
						<li>
							<%= link_to_unless_current h.name + ' (' + h.entries_count.to_s + ')', category_path(h), :title => h.description %>
						</li>
<% end -%>
					</ul>
				</li>
				<li>
					<h3>previous entries</h3>
					<ul>
<% @weblog.entries[0..9].each do |e| -%>
						<li>
							<%= link_to_unless_current e.title, article_path(e), :title => e.title %>
						</li>
<% end -%>
					</ul>
				</li>
<% unless @weblog.messages.empty? -%>
				<li>
					<h3>recent messages</h3>
					<ul>
<% @weblog.messages[0..9].each do |m| -%>
						<li>
							<%= link_to_unless_current m.body, article_path(m.entry) + '#' + m.id.to_s, :title => m.body %>
						</li>
<% end -%>
					</ul>
				</li>
<% end -%>
				<li>
					<h3>monthly archives</h3>
					<ul>
<% @weblog.archives(@time_zone).each do |k, v| -%>
						<li>
							<%= link_to_unless_current k.strftime('%B %Y') + ' (' + v.size.to_s + ')', :controller => :archives, :action => k.year, :id => k.month %>
						</li>
<% end -%>
					</ul>
				</li>
				<li>
					<h3>full-text search</h3>
					<% form_tag '/search' do %>
						<p>
							<%= text_field_tag 'query' %> 
							<%= link_to_function 'Search', 'submit()' %>
						</p>
					<% end %>
				</li>
				<li>
					<h3>site statistics</h3>
					<dl>
						<dt>Articles:</dt>
						<dd><%= @weblog.articles_count %> in <%= pluralize @weblog.categories_count, 'category' %></dd>
						<dt>Photos:</dt>
						<dd><%= @weblog.photos_count %> in <%= pluralize @weblog.albums_count, 'album' %></dd>
						<dt>Messages:</dt>
						<dd><%= pluralize @weblog.comments.size, 'comment' %> &amp; <%= pluralize @weblog.trackbacks.size, 'trackback' %></dd>
						<dt>Theme:</dt>
						<dd>games</dd>
						<dt>Locale:</dt>
						<dd><%= request.env['HTTP_ACCEPT_LANGUAGE'] %></dd>
						<dt>Time Zone:</dt>
						<dd><%= @time_zone.tzinfo.name %></dd>
					</dl>
				</li>
				<li>
					<h3>favourites &amp; friends</h3>
					<ul>
<% @weblog.links.each do |l| -%>
						<li>
							<%= link_to l.name, l.url, :title => l.description %>
						</li>
<% end -%>
					</ul>
				</li>
				<li>
					<h3>miscellaneous</h3>
					<ul>
						<li>
							<%= link_to image_tag('valid-xhtml11.png', :alt => 'Valid XHTML 1.1'), 'http://validator.w3.org/check?uri=referer' %>
						</li>
						<li>
							<%= link_to image_tag('valid-css.png', :alt => 'Valid CSS!'), 'http://jigsaw.w3.org/css-validator/check/referer' %>
						</li>
					</ul>
				</li>
			</ul>
			<div>
				<h2>Powered By
					<%= link_to 'Favourails', 'http://www.favourails.org/', :title => 'Favourails' %>
				</h2>
				<h3></h3>
			</div>
		</div>
	</body>
</html>
